import { createApp } from 'vue'
import App from './App.vue'
import pinia from '@/store'
import router from '@/router'
import '@/style/reset.css'
import 'echarts'
import VueECharts from 'vue-echarts'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import baiduMap from 'vue3-baidu-map-gl'

const app = createApp(App)

app.component('v-chart', VueECharts)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 监听回退
window.addEventListener(
  'popstate',
  function (e) {
    history.pushState(null, '', document.URL)
  },
  false
)

app
  .use(baiduMap, {
    ak: '6PWOs8xthsve2hT96MysoLOeh27g9Tvh',
    plugins: ['TrackAnimation'],
  })
  .use(pinia)
  .use(router)
  .mount('#app')
